home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 015a / stuf12.zip / BATSTUFF.DOC < prev    next >
Text File  |  1991-09-13  |  38KB  |  916 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                           STEENBURGH'S STUFF
  8.                        Mildly Useful Utilities
  9.                            For Batch Files
  10.                              Version 1.2
  11.                   Copyright 1991 by Chuck Steenburgh
  12.        
  13.           Practically everyone who owns a PC has written a batch
  14.        file at one time or another.  Batch files can give even the
  15.        novice user powerful tools to manage and control his or her
  16.        computer.  While the capabilities of batch files have slow-
  17.        ly improved through successive releases of MS-DOS, there 
  18.        are real limits on what you are capable of with batch files.
  19.        
  20.           Some of the biggest complaints about batch files:
  21.        
  22.           - Lack of interactive features
  23.        
  24.           - Poor screen/speaker output capabilities
  25.        
  26.           - SLOW!
  27.        
  28.           - Inability to to access certain types of system info
  29.        
  30.           Over the years, many batch file "compiler" languages 
  31.        have appeared on the scene.  Interested in greater speed
  32.        and power for my batch files, I evaluated several of the
  33.        shareware versions of these utilities.  Unfortunately,
  34.        they only seemed to be as hard (if not harder) than learn-
  35.        ing a completely new programming language.  More often
  36.        than not, these systems wouldn't even compile "plain"
  37.        batch files that I was using without any special commands!
  38.        
  39.           Having struck out with the batch file compilers, I
  40.        then started collecting miscellaneous utilities to try
  41.        to expand my batch file capability piecemeal.  While there
  42.        are many excellent programs available, they generally
  43.        have drawbacks of one kind or another.  Some programs are
  44.        tiny (less than 1K) .COM files that are speedy but don't
  45.        do enough and have very limited options.  There are other
  46.        programs that are more capable, but bigger and slower and
  47.        usually involving several zillion command line switches to
  48.        get anything useful out of the program.
  49.        
  50.           Frustrated, I decided to start writing my own set of
  51.        utilities.  Over several month's time, these utilities de-
  52.        veloped into the collection I call "STEENBURGH'S STUFF:
  53.        Mildly Useful Utilities."  These programs are listed below:
  54.        
  55.             BATBOX:     Simple menu creation/input system
  56.             FREEDISK:   Checks for available disk space
  57.             INPUT:      Simple prompt/input system
  58.             KLS:        Colorful screen-clearing utility
  59.             LAUNCHER:   File selection/execution system
  60.             MUSIC11:    Plays transcribed sheet music on the PC
  61.  
  62.                                      Page 1
  63.  
  64.  
  65.  
  66.  
  67.  
  68.             RAND:       Random number generator
  69.             SKIP:       Prints blank lines from batch files
  70.             SOUNDER:    Wide range of noise making options
  71.             WAITFOR:    Timed pauses 
  72.             WHENISIT:   Date/time telling utility
  73.             WRITE:      Colorful output anywhere on screen
  74.             XD:         Create/switch directories at the same time
  75.        
  76.           As much as possible, I have tried to compromise between
  77.        program size on the one hand (keeping them small and fast)
  78.        and features on the other.  As you will see, most of the
  79.        programs are under 10K, and none is over 20K.  While this
  80.        is considerably larger than some assembly language programs
  81.        (I have a program that prints individual blank lines from
  82.        batch files that is only 12 bytes!), the entire collection
  83.        takes up less than 100K of disk space.  This is less than
  84.        just the documentation for some larger utilities!
  85.        
  86.           The size of these programs is due to their being compiled
  87.        in 'C'.  However, these programs are FAST, for several rea-
  88.        sons.  First, they were compiled with the Power C compiler
  89.        from Mix Software.  Power C may not be the most capable of
  90.        compilers, but it is probably the fastest DOS compiler around
  91.        overall.  (Folks who spend $495 on Microsoft C don't want to
  92.        believe that a $20 compiler is faster, but it is).  Second,
  93.        these programs leave out some of the "cute" features that
  94.        other programs include that slow them down considerably.  For
  95.        example, when you run "MUSIC11" you'll hear sounds all right,
  96.        but no animated cherubs will perform aerobatics while the
  97.        music plays.  When you run FREEDISK, you will not see an
  98.        aquarium filled with swimming fish representing the number
  99.        of occupied bytes of disk space.  You will get concise, neat
  100.        information on the screen, in most cases accompanied by an
  101.        errorlevel which can be evaluated intelligently.
  102.        
  103.        
  104.                      INDIVIDUAL PROGRAM DESCRIPTIONS
  105.                      ========== ======= ============
  106.        
  107.        BATBOX.EXE
  108.        
  109.           People have been creating menus with batch files for
  110.        years.  Some of these are quite elaborate, others very crude.
  111.        BATBOX is something in between.  BATBOX will allow you to
  112.        display an attractive, colorful menu and will wait for
  113.        the user to make a selection.  It will then set an appro-
  114.        priate ERRORLEVEL value which can be used to determine sub-
  115.        sequent actions in your batch file.
  116.        
  117.        Usage:       BATBOX  menufile
  118.        
  119.                  menufile        is the name of an ASCII text 
  120.                                  file which you create.  This
  121.                                  will contain the menu's title
  122.  
  123.                                      Page 2
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                  and a list of options.
  130.        
  131.           To create a menufile, use a text editor, word processor
  132.        that can save ASCII files, or EDLIN.COM or EDIT.COM that
  133.        come with DOS.  In a pinch, you can use the "copy con" com-
  134.        mand but this doesn't give you much in the way of an editing
  135.        capability.
  136.        
  137.           The structure of the menufile is simple.  The first line
  138.        contains your menu's title, up to 20 characters.  If you 
  139.        don't want a title, leave the line blank, without any spaces.
  140.        (Hint:  press RETURN immediately without doing anything else 
  141.        when you first begin editing your document.)  Each succes-
  142.        sive line contains a menu item, exactly as you want it to ap-
  143.        pear on the screen.  Do NOT include any blank lines here or 
  144.        you will end up with blank lines in your menu!
  145.        
  146.           A few limitations:  each line can contain no more than 60
  147.        characters (if you need more than this to describe your menu
  148.        choices, maybe you need Microsoft Windows, a Macintosh, or 
  149.        something else with lots of pictures).  In addition, your menu
  150.        items (but NOT the menu title) must each begin with a dis-
  151.        tinct letter in order for the selection function to work pro-
  152.        perly.  The selection function for BATBOX is case-insensitive,
  153.        so if you begin one line with the letter 's' and the other
  154.        with the letter 'S', these are considered the same.  Up to
  155.        10 menu items are permitted in any one file.  Finally, make
  156.        sure you include a space after the last letter of the last
  157.        menu item, but do NOT press return.  Save the file from that
  158.        point.
  159.        
  160.          When you type BATBOX on the command line followed by the
  161.        name of your menufile (they must both be in the current dir-
  162.        ectory), you will see a menu pop up in the middle of the
  163.        screen.  The title will appear at the top, with each of your
  164.        menu items (up to ten) appearing at double spaced-intervals
  165.        inside the menu box.  At the bottom of the menu you will see
  166.        a the message "Enter your menu choice: ".  If you have a 
  167.        color monitor, you will notice that the first letter of each
  168.        menu item appears in a different color than the rest of the
  169.        text.
  170.        
  171.           Selecting a menu item is as simple as pressing the first
  172.        letter in the name of that item (the letter that is displayed
  173.        in a different color).  BATBOX will then exit, and return an
  174.        errorlevel based on the key that was pressed.  See Appendix
  175.        1 for a list of legal first letters and the errorlevels that
  176.        are returned by BATBOX.  You can use the errorlevel value
  177.        that is returned to branch to different parts of your batch
  178.        file or to execute commands.  See the DEMO.BAT file for an
  179.        example of one way to do this.
  180.        
  181.        
  182.        FREEDISK.EXE
  183.  
  184.                                      Page 3
  185.  
  186.  
  187.  
  188.  
  189.  
  190.        
  191.           Ever started a program only to find out that your disk
  192.        did not have enough room to store any data?  Want to have
  193.        your batch files tell you when it is time to swap disks or
  194.        clean up your hard drive?  FREEDISK to the rescue!  FREEDISK
  195.        can be used from the command line as a quick way to deter-
  196.        mine your remaining disk space (much faster than using the
  197.        DOS commands like dir or chkdsk).  FREEDISK really shines,
  198.        however, in batch files, where it can help your batch file
  199.        programs make decisions based on remaining disk space.
  200.        
  201.        Usage:       FREEDISK [drive] [space needed]
  202.        
  203.                  drive           a single letter representing
  204.                                  the disk drive you want to
  205.                                  check.  You don't need a colon,
  206.                                  and the default is the current
  207.                                  disk drive.  [optional]
  208.        
  209.                  space needed    the number of kilobytes of free
  210.                                  disk space you feel is necessary
  211.                                  in order to continue.  A kilo-
  212.                                  byte is 1,024 bytes (binary pur-
  213.                                  ist that I am!).  [optional]
  214.        
  215.        Examples: 
  216.        
  217.             FREEDISK             displays the total and available
  218.                                  space on the current dirve.  Also
  219.                                  returns available space as error-
  220.                                  level (see below).
  221.        
  222.             FREEDISK b           displays the total and available
  223.                                  space on drive B.
  224.        
  225.             FREEDISK 10000       displays the total and available
  226.                                  space on the current drive.  If
  227.                                  the available space is less than
  228.                                  10,000 kilobytes, FREEDISK will
  229.                                  sound an alarm and set the error-
  230.                                  level.
  231.        
  232.           FREEDISK displays available and total space in megabytes.
  233.        Since a megabyte is 1,024 kilobytes or 1,048,576 bytes, the
  234.        numbers shown might look a little different than what the
  235.        guy who sold you your disk drive said.  That's OK, salesmen
  236.        tend to define a "K" as 1,000 so they can make their products
  237.        look better.  It's all the same, you're not losing any bytes
  238.        one way or another.  My salesman, for example said my Seagate
  239.        ST-251 had 42 megabytes; FREEDISK reports it at only 40.6 meg.
  240.        
  241.           FREEDISK will return one of four possible errorlevels:
  242.        
  243.             0   Normal termination, sufficient disk space available
  244.  
  245.                                      Page 4
  246.  
  247.  
  248.  
  249.  
  250.  
  251.             1   Error reading available disk space
  252.             2   Not enough space available
  253.             
  254.           When the no needed space is indicated on the command line,
  255.        FREEDISK will set the errorlevel equal to the amount of space
  256.        available on the drive, in 10K increments.  For example, if
  257.        you specify "FREEDISK A" on the command line, and drive A has
  258.        240K of free space left, FREEDISK will return an errorlevel of
  259.        24.  If there are more than 2.55 megabytes available, the 
  260.        errorlevel will be set to 255.  This feature is useful when
  261.        you want your batch file to selectively delete files on the
  262.        target until a certain amount of space remains (for example).
  263.        
  264.        
  265.        INPUT.EXE
  266.        
  267.           If you use batch files very often, you've probably acquired
  268.        a program called ASK.COM or QUERY.COM or something similar 
  269.        that allows you to ask questions and receive simple respones.
  270.        Usually, this involves typing an ECHO command with your
  271.        question, followed by ASK.COM or whatever.  If you do this
  272.        alot, you will probably appreciate the fact the INPUT.EXE
  273.        will accomplish the jobs of both the ECHO and ASK commands.
  274.        Add to this the greater flexibility that INPUT.EXE offers
  275.        in presenting your prompt to the user and in receiving input,
  276.        and you'll be sold.
  277.        
  278.        Usage:       INPUT ["prompt"] [color] [/c]
  279.        
  280.                  "prompt"        Enter the text you would like to
  281.                                  appear to prompt the user for
  282.                                  input.  This can be up to 59 char-
  283.                                  acters and must be enclosed in
  284.                                  quotation marks.
  285.        
  286.                  color           Enter a number representing the
  287.                                  color in which you want your mes-
  288.                                  sage to appear.  You must, of
  289.                                  course, have a color monitor and
  290.                                  card.  See Appendix 3.
  291.        
  292.                  /c              Include this switch if you want
  293.                                  your prompt message centered on
  294.                                  the current line.  If you include
  295.                                  this switch, you MUST include a
  296.                                  color value.
  297.        
  298.        Examples:
  299.        
  300.             INPUT "Select a number from one to 10"
  301.        
  302.             This prints the text "Select on number from one to 10"
  303.        on the current line and waits for a keypress.
  304.        
  305.  
  306.                                      Page 5
  307.  
  308.  
  309.  
  310.  
  311.  
  312.             INPUT "Press any key to continue" 79
  313.        
  314.             This prints the text "Press any key to continue" on the
  315.        current line in bright white on a red background and waits
  316.        for a keypress.
  317.        
  318.             INPUT "Press the space bar to exit" 143 /c
  319.        
  320.             This prints the text "Press the space bar to exit" cen-
  321.        tered on the current line in flashing bright white on a black
  322.        background.
  323.        
  324.           INPUT will also sound an alarm to let the user know that
  325.        a response is expected.
  326.        
  327.           When a key is pressed, INPUT will set the errorlevel equal
  328.        to the ASCII value of the key pressed.  This is slightly dif-
  329.        ferent from BATBOX in that INPUT is case sensitive and will
  330.        allow you to distinguish between upper and lower case letters.
  331.        See Appendix 2 for a complete list of the ASCII characters
  332.        theoretically supported by INPUT.
  333.        
  334.        
  335.        KLS.EXE
  336.        
  337.           KLS is a simple replacement for the DOS screen-clearing
  338.        function (CLS).  
  339.        
  340.        Usage:       KLS [color]
  341.        
  342.                  color           A number from the list below:
  343.        
  344.                                         0 - Black
  345.                                         1 - Blue
  346.                                         2 - Green
  347.                                         3 - Cyan
  348.                                         4 - Red
  349.                                         5 - Magenta
  350.                                         6 - Brown
  351.                                         7 - White
  352.                                         
  353.        Examples:
  354.             
  355.             KLS 4                Clears the screen & paints it red.
  356.             
  357.             KLS 6                Clears the screen & paints it brown.
  358.             
  359.        When the screen is cleared, it will be set to the color indi-
  360.        cated on the command line.  Entering KLS without parameters
  361.        is the same as issuing CLS (i.e., clear screen without color).
  362.        "KLS 0" is useful if you have used ANSI or some other method
  363.        to set your screen to a color other than black, but you want
  364.        a black screen temporarily.
  365.        
  366.  
  367.                                      Page 6
  368.  
  369.  
  370.  
  371.  
  372.  
  373.           KLS returns errorlevel codes as shown below:
  374.           
  375.             0 - Normal execution (color specified)
  376.             1 - Normal execution (no color specified)
  377.             2 - Error (did not execute)
  378.        
  379.        
  380.        LAUNCHER.EXE
  381.        
  382.           Do some of your programs require you to load a data file
  383.        once you start the program?  Are these data files located on
  384.        a crowded disk, or do you have to enter several cryptic com-
  385.        mands to get your program to load a data file?  LAUNCHER is
  386.        designed to work with any program that can accept the name of
  387.        a data file on the command line.  LAUNCHER will display a
  388.        menu of your data files, and then start your application with
  389.        the name of the file you select on the command line to be
  390.        loaded immediately.
  391.        
  392.           LAUNCHER uses a rather novel method of automatically de-
  393.        termining the name of the application you are going to use
  394.        it with.  Rather than needing a configuration file or compli-
  395.        cated command line switches, LAUNCHER reads the application
  396.        name from its own file name.  Rename the LAUNCHER.EXE file
  397.        after the application you want to run, PLUS ANY ONE ADDITIONAL
  398.        CHARACTER.  Put this renamed version of launcher in the same
  399.        directory as your application, and you're ready to LAUNCH!
  400.        
  401.        Usage:       NEWNAME [[path:\]filespec] [/f]
  402.        
  403.                  NEWNAME         This is the new name which you have
  404.                                  given to LAUNCHER.EXE, based on the
  405.                                  name of your application.
  406.                                  
  407.                  path:\          Optional drive and/or path for data
  408.                                  files.
  409.        
  410.                  filespec        This filespec designates what files
  411.                                  are to be displayed by LAUNCHER.
  412.                                  You may include a drive and/or dir-
  413.                                  ectory name, and wildcards (? *).
  414.                                  
  415.                  /f              Include only file names on command
  416.                                  line.  Normally, LAUNCHER will in-
  417.                                  clude any path you have specified
  418.                                  on the command line string built.
  419.                                  Use this switch if your application
  420.                                  does not require the path name.
  421.        
  422.        Examples:
  423.        
  424.             WPI b:\wp\*.doc      This will LAUNCH Word Perfect
  425.                                  (WP.EXE) after displaying all files
  426.                                  in the B:\WP subdirectory with the
  427.  
  428.                                      Page 7
  429.  
  430.  
  431.  
  432.  
  433.  
  434.                                  extension .DOC.  This assumes that
  435.                                  you have renamed LAUNCHER.EXE as
  436.                                  WPI.EXE and that this file is in the
  437.                                  same directory as Word Perfect.
  438.        
  439.             1234 c:\*.w??         This will LAUNCH Lotus 1-2-3
  440.                                  (123.BAT) after displaying all
  441.                                  worksheet files in the root direc-
  442.                                  tory of drive C.  This assumes that
  443.                                  you have renamed LAUNCHER.EXE as
  444.                                  1234.EXE and that this file is in
  445.                                  the same directory as 1-2-3.
  446.                                  
  447.             WSI c:\ws\docs\*.doc LAUNCHES WordStar (WS.EXE) from
  448.                                  data files in directory c:\ws\docs.
  449.                                  DOES NOT include the path when
  450.                                  LAUNCHING WordStar.
  451.        
  452.           For some inexplicable reason, Quattro Pro Version 3.0 does
  453.        not work correctly (i.e., locks up) after being LAUNCHED.  I
  454.        am trying to get Borland's Techincal Support folks to help me
  455.        figure out why, but until then, you probably shouldn't use
  456.        Quattro Pro 3.0 with LAUNCHER.EXE.
  457.        
  458.        
  459.        MUSIC11.EXE
  460.        
  461.            For some time now I have wanted an inexpensive way to 
  462.        play short tunes on my PC.  While there are many music pro-
  463.        grams available, they usually require expensive hardware, 
  464.        large memory overhead, too much musical knowledge, or custom-
  465.        made musical files that you had to buy from somebody.  Des-
  466.        perate, I finally decided to write my own program!
  467.        
  468.        Usage:       MUSIC11 file[.CM1]
  469.            
  470.                  file            The name of a music file with
  471.                                  extension .CM1 which contains
  472.                                  the transcribed music to be
  473.                                  played.  Extension is optional.
  474.        
  475.        Examples:
  476.        
  477.             MUSIC11 dixie2.cm1   Plays the song "Dixie" encoded
  478.                                  in the file DIXIE2.CM1 (this
  479.                                  file included with the STUFF).
  480.        
  481.           MUSIC11 returns errorlevel values as shown below:
  482.        
  483.             0   Normal termination
  484.             1   Invalid music file
  485.             2   Note improperly coded
  486.        
  487.           For information on how to create your own music files, see
  488.  
  489.                                      Page 8
  490.  
  491.  
  492.  
  493.  
  494.  
  495.        Appendix 4 and use the sample files as a guide.
  496.        
  497.        
  498.        RAND.EXE
  499.        
  500.           RAND provides simple random number generating capabilities
  501.        for batch files.  RAND returns a random number in the form of
  502.        the DOS errorlevel, which you can then evaluate in your batch
  503.        files.
  504.               
  505.        Usage:        RAND [max value]
  506.        
  507.                  max value       Upper limit of random number range.
  508.                                  RAND will generate an errorlevel
  509.                                  between 1 and this number.  The de-
  510.                                  fault is 100.  The maximum is 255.
  511.                                  
  512.        Examples:
  513.        
  514.             RAND                 Generates a random errorlevel be-
  515.                                  tween 1-100.
  516.                                  
  517.             RAND 10              Generates a random errorlevel be-
  518.                                  tween 1-10.
  519.                                  
  520.           If the max value specified is greater than 255 or less than
  521.        1, RAND sets the errorlevel to 0.
  522.        
  523.        
  524.        SKIP.EXE
  525.        
  526.           ECHO does not permit you to enter blank lines in batch 
  527.        files.  While there are various tricks to accomplish this, 
  528.        and a number of small .COM programs to accomplish this task, 
  529.        you must still enter a separate command for each blank line.
  530.        
  531.        Usage:       SKIP [lines]
  532.        
  533.                  lines           The number of lines you would like
  534.                                  to skip; the default is one.
  535.        
  536.        Examples:
  537.        
  538.             SKIP                 Skips a sinlge line
  539.        
  540.             SKIP 5               Skips five lines.
  541.        
  542.           SKIP sets the errorlevel equal to the number of lines skipped.
  543.        
  544.        
  545.        SOUNDER.EXE
  546.        
  547.           SOUNDER is an advanced replacement for any number of util-
  548.        ities (with names like BEEP.COM or MUSIC.COM).  Most of these
  549.  
  550.                                      Page 9
  551.  
  552.  
  553.  
  554.  
  555.  
  556.        programs make a simple noise or maybe play a short melody.
  557.        Most restrcit you to the same monotnous tones over and over
  558.        again.  SOUNDER not only presents you with a virtually unlim-
  559.        ited range of options which you can control, it will also gen-
  560.        erate over a 1,000 random tone combinations for you if you are
  561.        feeling indecisive, or play one of four random melodies.
  562.        
  563.        Usage:       SOUNDER [freq dur] | [note dur] | [m]
  564.        
  565.                  freq            A frequency in cycles per second
  566.                                  (Hz) of the tone you desire.  Valid
  567.                                  values are 19 to 15,000 Hz.
  568.        
  569.                  note            A musical note (A,B,C,D,E,F,G).
  570.        
  571.                  dur             Duration of tone or note in clock
  572.                                  ticks.  There are roughly 18.2
  573.                                  ticks per second.  Must be a whole
  574.                                  number between 1 and 100.
  575.        
  576.                  m               Indicates that SOUNDER should play
  577.                                  a few notes from one of four random
  578.                                  melodies encoded in the program.
  579.        
  580.                                  Entering SOUNDER without parameters
  581.                                  will cause it to produce from 1-3
  582.                                  random noises for a total length of
  583.                                  approximately 2/3 second.
  584.        
  585.        Examples:
  586.        
  587.             SOUNDER              Produces 1-3 random noises.
  588.        
  589.             SOUNDER 1000 18      Produces a 1,000 Hz tone for one
  590.                                  second.
  591.        
  592.             SOUNDER C 36         Produces a 'C' note for two 
  593.                                  seconds.
  594.        
  595.             SOUNDER m            Plays one of four random tunes.
  596.        
  597.           SOUNDER returns the following errorlevel codes:
  598.        
  599.             0   Tone or musical note properly sounded
  600.            1-3  Number of random noises generated
  601.             4   Random melody played
  602.             5   Invalid parameter (only one supplied)
  603.             6   Invalid parameter(s) (tone, frequency, and/or
  604.                 duration outside of allowable range)
  605.        
  606.        
  607.        WAITFOR.EXE
  608.        
  609.           Did you ever notice that if you want a batch file to wait
  610.  
  611.                                      Page 10
  612.  
  613.  
  614.  
  615.  
  616.  
  617.        for you, you have to use PAUSE?  This requires you to press
  618.        a key.  This may not be convenient at the moment, such as
  619.        when you're talking on two phones at once and your batch file
  620.        is patiently waiting for you to tell it to print those files
  621.        your boss is imnpatient for.  WAITFOR will simply cause your
  622.        batch file to cease operation for a designated number of sec-
  623.        onds and then resume.
  624.        
  625.        Usage:       WAITFOR seconds
  626.        
  627.                  seconds         Integer representing the number
  628.                                  of seconds you would like to
  629.                                  pause.
  630.        
  631.           WAITFOR sets the errorlevel equal to the number of seconds
  632.        paused.
  633.        
  634.        
  635.        WHENISIT.EXE
  636.        
  637.           WHENISIT is a highly flexible utility to provide control in
  638.        DOS batch files based on time and date.  With its many op-
  639.        tions, WHENISIT will allow your batch files to determine the
  640.        year, month, date, day of the week, hour, minute, second, or
  641.        whether it is morning or afternoon and make intelligent de-
  642.        cisions based on this information.
  643.        
  644.           For example, you may want certain actions performed at
  645.        boot time on certain days of the week or month.  Adding
  646.        WHENISIT to your AUTOEXEC.BAT file can allow you to make
  647.        these sort of decisons. (Or allow your computer to make them
  648.        for you automatically.)
  649.        
  650.        Usage:
  651.        
  652.                     WHENISIT [/a]|[/d]|[/h]|[/m]|[mi]|[/s]|[/w]|[/y]
  653.                     
  654.                  /a              Returns errorlevel based on am or pm
  655.                  
  656.                  /d              Returns errorlevel equal to date
  657.                  
  658.                  /h              Returns errorlevel equal to the hour
  659.                                  (24-hour clock)
  660.                              
  661.                  /m              Returns errorlevel equal to month
  662.                  
  663.                  /mi             Returns errorlevel equal to minute
  664.                  
  665.                  /s              Returns errorlevel equal to second
  666.                  
  667.                  /w              Returns errorlevel based on the day
  668.                                  of the week
  669.                                  
  670.                  /y              Returns errorlevel equal to the last
  671.  
  672.                                      Page 11
  673.  
  674.  
  675.  
  676.  
  677.  
  678.                                  two digits of the year.
  679.                                  
  680.        Examples:
  681.        
  682.             WHENISIT /a          Returns errorlevel of 2 if it is pm,
  683.                                  or 1 if it is am.
  684.                                  
  685.             WHENISIT /y          If your clock is set to the year
  686.                                  1991, returns an errorlevel of 91.
  687.                                  
  688.             WHENISIT /w          If your clock indicates that it is
  689.                                  Tuesday, returns an errorlevel of 3.
  690.                                  
  691.        Errorlevel Chart:
  692.        
  693.             Errorlevel  Switch:  /a            /m            /d
  694.             ----------         --------------------------------------
  695.                 1                AM        January         Sunday
  696.                 2                PM        February        Monday
  697.                 3                na        March           Tuesday
  698.                 4                na        April           Wednesday
  699.                 5                na        May             Thursday
  700.                 6                na        June            Friday
  701.                 7                na        July            Saturday
  702.                 8                na        August             na
  703.                 9                na        September          na
  704.                10                na        October            na
  705.                11                na        November           na
  706.                12                na        December           na
  707.                
  708.           The errorlevels returned through the use of other switches
  709.        should be self-explanatory.  If an error occurs, the an error-
  710.        level of 0 will be returned.
  711.        
  712.           Entering WHENISIT alone on the command line will present a
  713.        summary of the command line options for WHENISIT.
  714.        
  715.        
  716.        WRITE.EXE
  717.        
  718.           We know that ECHO has its limits, don't we?  WRITE will let
  719.        you have full control over the positioning and color of your
  720.        text messages in batch files.
  721.        
  722.        Usage:       WRITE "message" row [color] | [column] [color]
  723.        
  724.                  "message"       This is the text to be displayed,
  725.                                  which must be enclosed in quotes.
  726.        
  727.                  row             This is the row (0-24, top to bot-
  728.                                  tom) on which the text will appear.
  729.        
  730.                  [column]        This is the optional column (0-79,
  731.                                  left to right) where the text will
  732.  
  733.                                      Page 12
  734.  
  735.  
  736.  
  737.  
  738.  
  739.                                  begin printing.  The default is to
  740.                                  center the text on the row.  If this
  741.                                  is included, you must also include
  742.                                  a color value (or else this will be
  743.                                  interpreted as a color).
  744.        
  745.                  [color]         This is the optional color in which
  746.                                  to print the text.  See Appendix 3.
  747.        
  748.        Examples:
  749.        
  750.             WRITE "Hello" 0 0 15 Prints "Hello" in the top left cor-
  751.                                  ner of the screen, white on black.
  752.        
  753.             WRITE "Hello" 5      Centers "Hello" on line 5.
  754.        
  755.             WRITE "Hello" 10 79  Prints "Hello" centered on line 10
  756.                                  in bright white on a red background.
  757.        
  758.           WRITE returns errorlevels as follows:
  759.        
  760.             0   Normal termination
  761.             1   Row/Column values outside of allowable range
  762.             2   Color value outside of allowable range
  763.        
  764.        
  765.        XD.EXE
  766.        
  767.           XD is included as a directory creation/changing utility.
  768.        There are better ones available, I suggest you get one if
  769.        you can.  XD does offer advantages over the cd and md commands
  770.        found in DOS.
  771.        
  772.        Usage:       XD [drive:][\directory]...
  773.        
  774.                  drive:          Drive letter (with colon) that you
  775.                                  want to switch to.
  776.        
  777.                 \directory       Directory (with slash) that you want
  778.                                  to change to.  If it does not exist,
  779.                                  XD will create it and then move you
  780.                                  there.
  781.        
  782.        Examples:
  783.        
  784.             XD D:\DOS            Changes to drive D: (if necessary)
  785.                                  then changes to the \DOS directory,
  786.                                  creating it if necessary.
  787.                                  
  788.             XD QPRO\DATA         Changes to subdirectory QPRO, then
  789.                                  to subdirectory DATA, creating it
  790.                                  if necessary.
  791.                                  
  792.           If you are using XD to create a new directory, you may only
  793.  
  794.                                      Page 13
  795.  
  796.  
  797.  
  798.  
  799.  
  800.        create one new level.  For example, if you issue the command
  801.        "XD C:\DOS\UTILITY" and that directory does not exist, XD will
  802.        create IF C:\DOS already exists.
  803.        
  804.           XD sets the errorlevel to 1 if the above condition is en-
  805.        countered and it is unable to create a new directory.
  806.        
  807.        
  808.        DISCLAIMER
  809.        
  810.           The programs described in this documentation are guaran-
  811.        teed to absolutely nothing!  They have, however, in my exper-
  812.        ience performed essentially as described herein.  The author
  813.        will not be responsible for any loss or damages caused through
  814.        the use of these programs.
  815.        
  816.           All trademarks are property of their respective owners.
  817.        
  818.           The programs and documentation are Copyright 1991 by Chuck
  819.        Steenburgh.  You are encouraged to distribute these programs
  820.        provided the following conditions are met:
  821.        
  822.           - all files listed in the file FILES.TXT must be distrib-
  823.             uted together in UNMODIFIED form
  824.        
  825.           - you charge no more than a reasonable fee for copying or
  826.             subscription, and clearly indicate that payment of such
  827.             a fee does NOT grant ownership of the programs.
  828.        
  829.           You may evaluate these programs for up to 30 days on a free
  830.        trial basis.  After 30 days, you should register your use of
  831.        these programs.  The registration fee is $10, payable to the
  832.        author at the address given below.
  833.        
  834.           Let's be real: I don't plan to make alot of money this way.
  835.        Registration does have its advantages:
  836.        
  837.           - I am improving these programs all the time.  Registration
  838.             will get you IMMEDIATELY a disk with the latest version,
  839.             which includes a version of BATBOX with user-selected 
  840.             menu colors.  When Version 2.0 of these utilities is re-
  841.             leased, you will also receive that free of charge.
  842.        
  843.           - While I can't promise to include everyone's suggestions
  844.             in program updates, you can bet I'll listen to registered
  845.             users before any of you scrounges out there.
  846.        
  847.           - You will me feel all warm and fuzzy and appreciated, and
  848.             all that good stuff.
  849.        
  850.           - You will also get an evaluation copy of my text-file for-
  851.             matting program (used to produce the margins in this doc-
  852.             ument).
  853.        
  854.  
  855.                                      Page 14
  856.  
  857.  
  858.  
  859.  
  860.  
  861.           Send comments/registrations to:
  862.        
  863.                Chuck Steenburgh
  864.                304A North Main Street
  865.                Lexington, VA 24450
  866.                (703)464-5290
  867.        
  868.                CIS 72330,1776 (I haunt the IBMSYS and IBMPRO forums)
  869.        
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.                                      Page 15